//
//  MCAddPlanApi.swift
//  MCBodyBuildingPro
//
//  Created by Renlvshijie on 2023/6/5.
//

import Foundation
import Moya


enum MCAddPlanApi {
    case AddPlanApi(planDate:Array<String>?,planId:String?,planStartTime:String?)
}

extension MCAddPlanApi: TargetType {
    var baseURL: URL {
        return URL.init(string: Moya_baseURL)!
    }
    
    var path: String {
        switch self {
        case .AddPlanApi:
            return "api/admin/planForApp/joinUserPlan"
        }
    }
    var method:Moya.Method {
        switch self {
        case .AddPlanApi:
            return .post
       
       
        }
    }
    
    var sampleData: Data {
        return Data()
    }
    
    
    var task: Task {
        switch self {
        case let .AddPlanApi(planDate, planId, planStartTime):
            
            print(planDate as Any)
            print(planId as Any)
            print(planStartTime as Any)
            
            return .requestParameters(parameters: ["planDate": planDate ?? [],"planId":planId ?? "","planStartTime":planStartTime ?? ""], encoding: JSONEncoding.default)
        }
    }
    
    var headers: [String : String]? {
        let tokenName:String = UserDefaults.standard.string(forKey: "LoginName") ?? ""
        let tokenValue:String = UserDefaults.standard.string(forKey: "LoginToken") ?? ""
        return [tokenName:tokenValue]
    }
    
}
